import {request,RequestConfig,HttpRequestMethod,LengyuHttpResponse,PageRequestParam,download,upload,uploadBigFile}  from '../utils/request'


export interface SecretRealm{
  id?:string,
  userId?:string,
  characters?:string,
  name?:string,
  level?:string,
  realmDate?:Date,
  realmTime?:Date,
  hours?:number,
  shuoming?:string,
  imgUrls?:string,
  affixIds?:string,
  createTime?:string,
  updateTime?:string,
}

// 将微信用户信息保存到数据库
export function save(data:SecretRealm): Promise<LengyuHttpResponse> {
  let requestConfig:RequestConfig={
    url:'/secret-realm/save',
    method:HttpRequestMethod.POST,
    data:data,
    token:true,
  }
  return request(requestConfig);
}


export function page(param:PageRequestParam): Promise<LengyuHttpResponse> {
  let requestConfig:RequestConfig={
    url:'/secret-realm/page',
    method:HttpRequestMethod.POST,
    data:param,
    token:true,
  }
  return request(requestConfig);
}

export function detail(id:string): Promise<LengyuHttpResponse> {
  let requestConfig:RequestConfig={
    url:'/secret-realm/detail?id='+id,
    method:HttpRequestMethod.GET,
    token:true,
  }
  return request(requestConfig);
}

/**
 * 
 * @param url 文件上传地址
 * @param filePath 文件地址
 * @param fileName 文件名称
 * @param formData 
 */
export  function uploadImage(filePath:string,
  formData:any,size:number): Promise<LengyuHttpResponse> {
let requestConfig:RequestConfig={
url:"secret-realm/upload-files-part",
method:HttpRequestMethod.POST,
token:true,
data:formData,
}
return  uploadBigFile(requestConfig,filePath,size);
}